package com.hx.dc.controllor;

import com.github.pagehelper.PageInfo;
import com.hx.dc.entity.CommoDity;
import com.hx.dc.service.SeeShopService;
import com.sun.org.apache.bcel.internal.generic.RETURN;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Lenovo on 2019/2/15.
 */

@Controller
@RequestMapping("seeshop")
public class SeeShopAction extends BaseAction {

    @Autowired
    private SeeShopService seeShopService;


   /*初始商品*/
 /*  @RequestMapping(value ="sees")
     @ResponseBody
    public  Object SeeShop(){


         return seeShopService.SeeShop();
     };
*/
  /*   删除*/
    @RequestMapping(value ="delete")
    @ResponseBody
    public  Object delete(String  s ){

     String a[]=s.split("s");

       List list=new ArrayList();
/*     list.add(s);*/
      for(int i=0;i<a.length;i++){
            list.add(a[i]);
        }
     return  seeShopService.delete(list);
    };

 /*  添加*/
   @RequestMapping(value ="insert")
   @ResponseBody
    public Object insertt(CommoDity commoDity,String shopPicture1){

            commoDity.setFiles(shopPicture1);
       return   seeShopService.insertt(commoDity);
 };


    /* 修改*/
    @RequestMapping(value ="amend")
    @ResponseBody
    public Object amend(CommoDity commoDity){
      System.out.print("1111111111111111111111111111"+commoDity);
        return seeShopService.amden(commoDity);
    };

    @RequestMapping(value ="sees")
    @ResponseBody
    // easyui提交数据：page:1 rows:15
    public Object selectPage(CommoDity commoDity, Integer page, Integer rows) {
        System.out.println("page:" + page + ",rows:" + rows);

        return this.getPage(seeShopService.selectPage(commoDity, page, rows));
    }


}
